import { Reducer } from 'redux';
// import {  } from 'dva';
import layerCreator from '@/utils/arcgis/layer/layer-creator';

export type TActiveToolbar = 'city' | 'urban' | 'plan' | 'bim' | 'smart' | 'toolbox' | '';
export interface ToolbarModelState {
  activeToolbar: TActiveToolbar;
  layerClassify: Array<Object>;
}

export interface ToolbarModelTypes {
  namespace: 'toolbar';
  state: ToolbarModelState;
  effects: {};
  reducers: {
    updataActiveToolbar: Reducer<ToolbarModelState>;
    updateLayerClassify: Reducer<ToolbarModelState>;
  };
}

const ToolbarModel: ToolbarModelTypes = {
  namespace: 'toolbar',

  state: {
    activeToolbar: 'city', // 激活的工具状态
    layerClassify: [],
  },

  effects: {

  },

  reducers: {
    updataActiveToolbar(
      state = { activeToolbar: '', layerClassify: [] },
      action,
    ): ToolbarModelState {
      return { ...state, activeToolbar: action.payload };
    },
    updateLayerClassify(
      state = { activeToolbar: '', layerClassify: [] },
      action,
    ): ToolbarModelState {
      return { ...state, layerClassify: action.payload };
    },
  },
};

export default ToolbarModel;
